home *** CD-ROM | disk | FTP | other *** search
/ Gurewich OLE Controls for Visual Basic 4 / Gurewich OLE Controls for Visual Basic 4.iso / ocxprog / programs / ch07 / spin.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-08-24  |  7.3 KB  |  232 lines

  1. VERSION 4.00
  2. Begin VB.Form frmSpin 
  3.    BackColor       =   &H00808080&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "The Spin Program"
  6.    ClientHeight    =   4995
  7.    ClientLeft      =   1800
  8.    ClientTop       =   1800
  9.    ClientWidth     =   4335
  10.    Height          =   5685
  11.    Icon            =   "SPIN.frx":0000
  12.    Left            =   1740
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   4995
  16.    ScaleWidth      =   4335
  17.    Top             =   1170
  18.    Width           =   4455
  19.    Begin VB.CheckBox chkCustomPictures 
  20.       BackColor       =   &H00808080&
  21.       Caption         =   "&Use Custom Pictures"
  22.       Height          =   255
  23.       Left            =   240
  24.       TabIndex        =   3
  25.       Top             =   3720
  26.       Width           =   1935
  27.    End
  28.    Begin VB.HScrollBar hsbInterval 
  29.       Height          =   255
  30.       Left            =   240
  31.       Max             =   1000
  32.       Min             =   50
  33.       SmallChange     =   100
  34.       TabIndex        =   2
  35.       Top             =   4200
  36.       Value           =   50
  37.       Width           =   3855
  38.    End
  39.    Begin TegoswLibCtl.Tegosw swExit 
  40.       Height          =   630
  41.       Left            =   0
  42.       TabIndex        =   6
  43.       Top             =   0
  44.       Width           =   525
  45.       _version        =   65536
  46.       _extentx        =   926
  47.       _extenty        =   1111
  48.       _stockprops     =   64
  49.       value           =   -1  'True
  50.    End
  51.    Begin VB.Label lblSlowest 
  52.       BackColor       =   &H00808080&
  53.       Caption         =   "Slowest"
  54.       Height          =   255
  55.       Left            =   3480
  56.       TabIndex        =   5
  57.       Top             =   4440
  58.       Width           =   615
  59.    End
  60.    Begin VB.Label lblFastest 
  61.       BackColor       =   &H00808080&
  62.       Caption         =   "Fastest"
  63.       Height          =   255
  64.       Left            =   240
  65.       TabIndex        =   4
  66.       Top             =   4440
  67.       Width           =   615
  68.    End
  69.    Begin VB.Label lblCounter 
  70.       Alignment       =   2  'Center
  71.       BackColor       =   &H00808080&
  72.       Caption         =   "0"
  73.       BeginProperty Font 
  74.          name            =   "Times New Roman"
  75.          charset         =   0
  76.          weight          =   400
  77.          size            =   72
  78.          underline       =   0   'False
  79.          italic          =   0   'False
  80.          strikethrough   =   0   'False
  81.       EndProperty
  82.       Height          =   1455
  83.       Left            =   720
  84.       TabIndex        =   1
  85.       Top             =   0
  86.       Width           =   3015
  87.    End
  88.    Begin TegspinLibCtl.TegoSpin TegoSpin1 
  89.       Height          =   1800
  90.       Left            =   1920
  91.       TabIndex        =   0
  92.       Top             =   1680
  93.       Width           =   900
  94.       _version        =   65536
  95.       _extentx        =   1588
  96.       _extenty        =   3175
  97.       _stockprops     =   64
  98.       bevelwidth      =   9
  99.       interval        =   50
  100.       picturespinup   =   "SPIN.frx":030A
  101.       picturespindown =   "SPIN.frx":0326
  102.    End
  103.    Begin VB.Menu mnuFile 
  104.       Caption         =   "&File"
  105.       Begin VB.Menu mnuExit 
  106.          Caption         =   "E&xit"
  107.       End
  108.    End
  109.    Begin VB.Menu mnuHelp 
  110.       Caption         =   "Help"
  111.       Begin VB.Menu mnuAbout 
  112.          Caption         =   "&About..."
  113.       End
  114.    End
  115. Attribute VB_Name = "frmSpin"
  116. Attribute VB_Creatable = False
  117. Attribute VB_Exposed = False
  118. ' All variables must be declared.
  119. Option Explicit
  120. Private Sub chkCustomPictures_Click()
  121.    Dim Path
  122.    ' Get the name of the directory where the
  123.    ' program resides.
  124.    Path = App.Path
  125.    If Right(Path, 1) <> "\" Then
  126.       Path = Path + "\"
  127.    End If
  128.    ' If the chkCustomPictures check box is checked, load pictures
  129.    ' into the spin control. Otherwise, unload the pictures from the
  130.    ' spin control.
  131.    If chkCustomPictures.Value = 0 Then
  132.       TegoSpin1.PictureSpinUp = LoadPicture("")
  133.       TegoSpin1.PictureSpinDown = LoadPicture("")
  134.    Else
  135.       TegoSpin1.PictureSpinUp = LoadPicture(Path + "SpinUp.BMP")
  136.       TegoSpin1.PictureSpinDown = LoadPicture(Path + "SpinDown.BMP")
  137.    End If
  138. End Sub
  139. Private Sub hsbInterval_Change()
  140.     ' Set the Interval property of the spin control to the value
  141.     ' of the hsbInterval scroll bar.
  142.     TegoSpin1.Interval = hsbInterval.Value
  143. End Sub
  144. Private Sub mnuAbout_Click()
  145.    Dim Title
  146.    Dim Msg
  147.    Dim CR
  148.    CR = Chr(13) + Chr(10)
  149.    ' The title of the About message box.
  150.    Title = "About the Spin Program"
  151.    ' Prepare the message of the About message box.
  152.    Msg = "This program was written with Visual "
  153.    Msg = Msg + "Basic for Windows, using the "
  154.    Msg = Msg + "TegoSoft Spin OCX control. "
  155.    Msg = Msg + CR + CR
  156.    Msg = Msg + "The TegoSoft Spin OCX control "
  157.    Msg = Msg + "is part of the TegoSoft OCX Control "
  158.    Msg = Msg + "Kit - a collection of various OCX controls. "
  159.    Msg = Msg + CR + CR
  160.    Msg = Msg + "For more information about the "
  161.    Msg = Msg + "TegoSoft OCX Control Kit, contact TegoSoft "
  162.    Msg = Msg + "at:"
  163.    Msg = Msg + CR + CR
  164.    Msg = Msg + "TegoSoft Inc." + CR
  165.    Msg = Msg + "P.O. Box 389" + CR
  166.    Msg = Msg + "Bellmore, NY 11710"
  167.    Msg = Msg + CR + CR
  168.    Msg = Msg + "Phone: (516)783-4824"
  169.    ' Display the About message box.
  170.    MsgBox Msg, vbInformation, Title
  171. End Sub
  172. Private Sub mnuExit_Click()
  173.    ' Terminate the program.
  174.    Unload Me
  175. End Sub
  176. Private Sub swExit_Click()
  177.    Dim Title
  178.    Dim Question
  179.    Dim Response
  180.    ' If the user turned the swExit switch OFF,
  181.    ' confirm that the user wants to exit the
  182.    ' program, and if so, exit the program.
  183.    If swExit.Value = False Then
  184.       Title = "Exit Program"
  185.       Question = "Are you sure you want to exit?"
  186.       Response = MsgBox(Question, vbYesNo + vbQuestion, Title)
  187.       If Response = vbYes Then
  188.          Unload Me
  189.       Else
  190.          swExit.Value = True
  191.       End If
  192.    End If
  193. End Sub
  194. Private Sub TegoSpin1_SpinDown()
  195.    Dim Counter
  196.    ' Get the numeric value of the lblCounter label.
  197.    Counter = Val(lblCounter.Caption)
  198.    ' Decrement the count by 1.
  199.    Counter = Counter - 1
  200.    ' Is Counter less than 0?
  201.    If Counter < 0 Then
  202.       ' Counter is less than 0, so stop flashing the spin control
  203.       ' and reset counter to 0.
  204.       TegoSpin1.Flash = False
  205.       Counter = 0
  206.    Else
  207.       ' Counter is greater than 0, so keep flashing the spin control.
  208.       TegoSpin1.Flash = True
  209.    End If
  210.    ' Update the lblCounter label with the new count.
  211.    lblCounter.Caption = Str(Counter)
  212. End Sub
  213. Private Sub TegoSpin1_SpinUp()
  214.    Dim Counter
  215.    ' Get the numeric value of the lblCounter label.
  216.    Counter = Val(lblCounter.Caption)
  217.    ' Increment the count by 1.
  218.    Counter = Counter + 1
  219.    ' Is Counter greater than 100?
  220.    If Counter > 100 Then
  221.       ' Counter is greater than 100, so stop flashing the spin control
  222.       ' and set counter to 100.
  223.       TegoSpin1.Flash = False
  224.       Counter = 100
  225.    Else
  226.       ' Counter is less than 100, so keep flashing the spin control.
  227.       TegoSpin1.Flash = True
  228.    End If
  229.    ' Update the lblCounter label with the new count.
  230.    lblCounter.Caption = Str(Counter)
  231. End Sub
  232.